package me.dr0n3.skyAdopt.Utils;

import java.util.HashMap;
import java.util.LinkedList;
import org.bukkit.World;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Ocelot;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wolf;

/**
 * @author dr0n3
 * @date 17.04.2012
 */
public class AnimalHelper 
{
    public static HashMap<Player, LinkedList<Wolf>> hmWolfes = new HashMap<>();
    public static HashMap<Player, LinkedList<Ocelot>> hmCats = new HashMap<>();
    
    public static void countAnimals(Player player)
    {
        hmWolfes.put(player, new LinkedList<Wolf>());
        hmCats.put(player, new LinkedList<Ocelot>());
        
        for(World w : player.getServer().getWorlds())
        {
           for(LivingEntity e : w.getLivingEntities())
           {
               if(e instanceof Wolf && ((Wolf) e).isTamed() && ((Wolf) e).getOwner().equals(player))
               {
                   hmWolfes.get(player).add((Wolf) e);
               }
               else if(e instanceof Ocelot && ((Ocelot) e).isTamed() && ((Ocelot) e).getOwner().equals(player))
               {
                   hmCats.get(player).add((Ocelot) e);
               }
           }
        }
    }
}
